from django.urls import path
from book2.views import index
from book2.views import goods,register,json,method,response
from django.urls.converters import register_converter

class MobileConverter:
    regex = '1[3-9]\d{9}'
    def to_python(self,value):
        return int(value)
    def to_url(self,value):
        return value


register_converter(MobileConverter,'phone')

urlpatterns = [
    path('index/',index),
    path('<int:cat_id>/<phone:goods_id>/',goods),
    path('register/',register),
    path('json/',json),
    path('method/',method),
    path('res/',response)
]